@echo off

setlocal

if "%1" == "" goto :usage

set distro=%1

if "%distro:~0,1%" == "-" goto :usage
if "%distro:~0,1%" == "/" goto :usage

if not exist %distro% (
	echo not exist: %distro%
	goto :eof
)

if "%2" == "-y" set yes=1

if "%yes%"=="" (
	choice /C NY /M "confirm remove distro: %distro%" 
	if not errorlevel 2 goto :eof
)

cd /d %~dp0

wsl -t %distro% && ^
wsl --unregister %distro% && ^
del %distro%.exe && ^
rd /s/q %distro%
goto :eof

:usage
echo USAGE:
echo   %0 del [DISTRO] [-y]  delete the distro
